<?php
session_start();
include "actions/db_connect.php";

$page = $_GET['page'];
$view_path = "views/admin/";
$flag = $_SESSION['is_loggedin'];
        if($flag != "yes")
            header("location:admin_login.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>admin_panel</title>
        <link rel="stylesheet" href="css/admin/style.css" type="text/css" media="all" />
        <link rel="stylesheet" href="tinymc/examples/css/content.css" type="text/css" media="all" />

            <?php include $view_path."tinymce.php"; ?>
            <script type="text/javascript">
                function blank(a)
                { if(a.value == a.defaultValue) a.value = ""; }
                function unblank(a)
                { if(a.value == "") a.value = a.defaultValue; }
            </script>
    </head>
        <body>
        <!-- Header -->
            <div id="header">
                <div class="shell">
                    <!-- Logo + Top Nav -->
                    <div id="top">
                        <h1> <a href="#">News On Click</a> </h1>
                            <div id="top-navigation">
                                        Welcome <a href="admin.php?page=admin_detail&admin_id=<?php echo $_SESSION['user_id']; ?>"><strong><?php echo $_SESSION['name']; ?></strong></a>
                                <span>|</span>
                                <a href="index.php">View Website</a>
                                <span>|</span>
                                <a href="#">Help</a>
                                <span>|</span>
                                <a href="#">Profile Settings</a>
                                <span>|</span>
                                <a href="actions/logout.php">Log out</a>
                            </div>
                    </div>
                    <!-- End Logo + Top Nav -->

                    <!-- Main Nav -->
                    <div id="navigation">
                        <?php include $view_path."nav.php";  ?>
                    </div>
                    <!-- End Main Nav -->
                </div>
            </div>
        <!-- End Header -->

        <!-- Container -->
        <div id="container">
            <div class="shell">
                <!-- Small Nav -->
                    <div class="small-nav">
                        <a href="#">Dashboard</a>
                        <span>&gt;</span>
                            Current Articles
                    </div>
               

                <!--<div class="msg msg-ok">
                        <p><strong>Your file was uploaded successfully!</strong></p>
                        <a href="#" class="close">close</a>
                    </div>
             

        
                    <div class="msg msg-error">
                        <p><strong>You must select a file to upload first!</strong></p>
                        <a href="#" class="close">close</a>
                    </div>
                -->
            
   
                <!-- Main -->
                    <div id="main">
                        <div class="cl">&nbsp;</div>
                        <!-- Content -->
                            <div id="content">
                                <!-- Box -->
                                <?php
                                    if($page=="")
                                    {
                                        include $view_path."news_list.php";
                                        include $view_path."news_new.php";
                                    }
                                    else if($page=="news_add") include $view_path."news_new.php";
                                    else if($page=="news_show") include $view_path."news_show.php";
                                    else if($page=="news_edit") include $view_path."news_edit.php";
                                    else if($page=="cat_list") include $view_path."cat_list.php";
                                    else if($page=="cat_edit") include $view_path."cat_edit.php";
                                    //admin page callings
                                    else if($page=="admin_list")
                                        {
                                        include $view_path."admin_list.php";
                                        include $view_path."admin_add.php";
                                        }
                                    else if($page=="admin_edit") include $view_path."admin_edit.php";
                                    else if($page=="admin_detail") include $view_path."admin_detail.php";
                                    else if($page=="gallery") include $view_path."gallery.php";
                                    else if($page=="about") include $view_path."about_display.php";
                                    else if($page=="about_editor") include $view_path."about_editor.php";
                                   
                                        
                                    
                                ?>
                                <!-- End Box -->
                            </div>
                        <!-- End Content -->

                <!-- Sidebar -->
                <div id="sidebar">

                    <!-- Box -->
                        <div class="box">

                        <!-- Box Head -->
                            <div class="box-head">
                                <h2>Management</h2>
                            </div>
                        <!-- End Box Head-->

                            <div class="box-content">

                                <a href="admin.php?page=news_add" class="add-button"><span>Add new Article</span></a>
                                <div class="cl">&nbsp;</div>

                                <p class="select-all"><input type="checkbox" class="checkbox" /><label>select all</label></p>
                                <p> <a href="#">Delete Selected</a> </p>

                                <!-- Sort -->
                                <div class="sort">
                                    <label>Sort by</label>

                                    <select class="field">
                                        <option value="">Title</option>
                                    </select>
                                    <select class="field">
                                        <option value="">Date</option>
                                    </select>
                                    <select class="field">
                                        <option value="">Author</option>

                                    </select>
                                </div>
                                <!-- End Sort -->

                            </div>
                        </div>
                    <!-- End Box -->
                </div>
                <!-- End Sidebar -->

                        <div class="cl">&nbsp;</div>
                    </div>
                <!-- Main -->
            </div>
        </div>
        <!-- End Container -->

        <!-- Footer -->
      <?php include $view_path."footer.php";  ?>
        <!-- End Footer -->

    </body>
</html>

